package com.sky.controller.user;

import com.sky.entity.Setmeal;
import com.sky.result.Result;
import com.sky.service.SetmealService;
import com.sky.vo.DishItemVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * TODO
 *
 * @Author mr.wu
 * @Data #{DATE} #{TIME}
 */
@RestController
@RequestMapping("/user/setmeal")
public class UserSetmealController {

    @Autowired
    private SetmealService setmealService;

    /**
     * PC端 根据分类id查询套餐
     * @param categoryId
     * @return
     */
    @GetMapping("/list")
    public Result <List<Setmeal>> getPcSetmeal(@RequestParam Long categoryId){
       List<Setmeal> list = setmealService.getPcSetmeal(categoryId);
        return Result.success(list);
    }

    /**
     * PC端 根据套餐id查询包含的菜品
     * @param id
     * @return
     */
    @GetMapping("/dish{id}")
    public Result <List<DishItemVO>> getPcSetmealDish(@PathVariable Long id){
        List<DishItemVO> list = setmealService.getPcSetmealDish(id);
        return Result.success(list);
    }

}
